<template>
  <div class="tpl20-head" :style="{'background-image':'url('+PModules.bg+')'}">
    <div class="con-box" v-if="PModules">
      <div class="homeCpay" v-if="PModules.button && PModules.button.showtitle" :style="{'top':PModules.button.top+'px'}">
        <a @click="openLink(PModules.button.link)">{{PModules.button.showtitle}}</a>
      </div>
      <div class="homeCcon">
        <p :style="{color:PModules.titleColor}">{{PModules.title}} </p>
        <span :style="{color:PModules.subTitleColor}">{{PModules.subTitle}}</span>
      </div>
      <div class="tpl20-nav">
        <ul class="swiper-wrapper">
          <li class="item"
              v-for="(item,index) in PModules.dataset"
              :key="index"
              :style="{'background-color':item.bgColor}">
            <a @click="openLink(item.link)">
              <img :src="item.pic" width="40" height="40">
              <div>{{item.showtitle}}</div>
            </a>
          </li>
        </ul>
      </div>
    </div>  
  </div>
</template>

<script>
  import Vue from 'vue'
  import { openPage } from '@/utils/utils'
  export default Vue.extend({
  props: {
    tplItemData: {
      type: Object // 传入参数的类型
    }
  },
  data() {
    return {
      PModules: {}
    }
  },
  created() {
    if (this.tplItemData.PModules) {
      this.PModules = this.tplItemData.PModules
    }
  },
  methods: {
    openLink(url){
      openPage(url)
    }
  }
})
</script>

<style lang="scss">
.tpl20-head{
  position:fixed;
  top:0;
  left:0;
  width:100%;
  height:100%;
  background: url("https://img.wifenxiao.com/h5-wfx/images/diy/tpl20/20bg.jpg") center center no-repeat;
  background-size: cover;
  .homeCpay{
    width: 400px;
    height: 60px;
    line-height: 60px;
    text-align: center;
    background:none;
    border-radius: 1px;
    padding:6px;
    border:1px solid #936e5d;
    font-size: 28px;
    position: absolute;
    top: 25%;
    left: 50%;
    margin-left: -200px;
    a{
      display: inline-block;
      color: #fff;
      width: 100%;
      line-height: 60px;
      background:#936e5d;
    }
  }
  .homeCcon{
    width: 100%;
    text-align: center;
    color: #597b26;
    padding-top: 132px;
    font-size: 34px;
    span{
      color:#727272;
    }
    p{
      font-size: 72px;
	    line-height: 80px;
    }
  }
  .tpl20-nav{
    position:absolute;
    left:0;
    bottom:0;
    width:100%;
    ul {
      font-size:0;
      li{
        width: 25%;
        height: 140px;
        display: inline-block;
        text-align:center;
        background-color: rgba(255,255,255,0.6);
        div{
          color:#1a1a1a;
          font-size: 28px;
          line-height: 60px;
          padding-top: 0px;
        }
        img {
          display: inline-block;
          width: 40px;
          height: 40px;
          padding-top: 30px;
        }
      }
    }
  }
}
</style>
